package entities;

/*
    父类包含成员变量：血量，x，y，图片，图片宽，图片高
 */

import index.StartGame;
import tools.Award;

import java.util.Random;

public class LittleEnemy extends FlyingObject implements Award {
//分数未考虑
    public LittleEnemy() {
        super(StartGame.LITTLE_ENEMY_HP,  //小敌机血量
                new Random().nextInt(StartGame.INTERFACE_WIDTH - StartGame.littleEnemy.getWidth()),  //小敌机初始位置,范围是屏幕从最左侧，到图片右侧贴边结束
                0-StartGame.littleEnemy.getHeight(),  //初始在屏幕外
                StartGame.littleEnemy, //小敌机初始图片
                StartGame.LITTLE_ENEMY_SCORE);  //小敌机初始分数
        setP_height(getAppearance().getWidth());
        setP_height(getAppearance().getHeight());
    }

    @Override
    public void move() {
        //直线向下
        this.setY(this.getY() + StartGame.LITTLE_ENEMY_SPEED);
    }

    @Override
    public void giveAward(HeroPlane hero) {
        //给奖励,小敌机只给一分
        hero.setScore(hero.getScore() + StartGame.LITTLE_ENEMY_SCORE);
    }
}
